<?php

namespace App\Libs\Strategy;


use Illuminate\Database\Eloquent\Model;

class UpdateData implements IStrategy
{

    private $data;

    private $model;

    private $id;

    public function __construct($data,Model $model,$id)
    {
        $this->data = $data;
        $this->model = $model;
        $this->id = $id;
    }

    public function algorithm()
    {
        return ($this->model->find($this->id))->update($this->data);
    }
}
